/*ie6- ActiveXObject*/
if(typeof XMLHttpRequest=="undefined"){
	XMLHttpRequest=function(){
		return new ActiveXObject(navigator.userAgent.indexOf("MSIE 5")>=0?"Microsoft.XMLHTTP":"Msxml2.XMLHTTP");
	}
}
var wym={};
/*using object as paramter*/
wym.ajax=function(option){
	option={
		type:option.type||"POST",
		url:option.url||"",
		data:option.data||"",
		onSuccess:option.onSuccess||function(){},
		onComplete:option.OnComplete||function(){},
		onError:option.onError||function(){},
		dataType:option.dataType||"",
		asyn:true
	};
	if(option.type.toUpperCase()!="POST"&&option.data!=""){
		if(option.url.indexOf("?")>0){
			option.url=option.url+"&"+option.data;
		}else{
			option.url=option.url+"?"+option.data;
		}
	}
	var xml=new XMLHttpRequest();
	xml.open(option.type,option.url,option.asyn);
	xml.onreadystatechange=function(){
		if(xml.readyState==4){
			if(httpSuccess(xml)){
				option.onSuccess(httpData(xml,option.dataType));
			}else{
				option.onError();
			}
			option.onComplete();
			xml=null;
		}
	}
	if(option.type.toUpperCase()=="POST"&&option.data!=""){
		xml.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		xml.send(option.data);
	}else{
		xml.send();
	}
	function httpSuccess(exml){
		try{
			return !exml.status&&location.protocol=="file:"||(exml.status>=200&&exml.status<300)||exml.status==304||navigator.userAgent.indexOf("Safari")>=0&&typeof exml.status=="undefined";
		}catch(e){
			
		}
		return false;
	}
	function httpData(exml,dataType){
		var content=exml.getResponseHeader("content-type");
		var data=!dataType&&content&&content.indexOf("xml")>=0;
		data=dataType=="xml"||data?exml.responseXML:exml.responseText;
		if(dataType=="script"){
			eval.call(window,data);
		}
		return data;
	}
}